package common.view;

import javax.swing.JPanel;
import javax.swing.SpringLayout;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
import javax.swing.JButton;
import javax.swing.JList;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;

public class LiveIndentsView extends  JPanel{
	private JLabel lblOpenIndents;
	private JButton btnSave;
	private JTable table;
	private JList list;
	private JScrollPane scrollPane_1;
	public LiveIndentsView() {
		SpringLayout springLayout = new SpringLayout();
		setLayout(springLayout);
		
		lblOpenIndents = new JLabel("Open Indents:");
		springLayout.putConstraint(SpringLayout.NORTH, lblOpenIndents, 10, SpringLayout.NORTH, this);
		springLayout.putConstraint(SpringLayout.WEST, lblOpenIndents, 10, SpringLayout.WEST, this);
		add(lblOpenIndents);
		
		btnSave = new JButton("SAVE");
		springLayout.putConstraint(SpringLayout.WEST, btnSave, 200, SpringLayout.WEST, this);
		springLayout.putConstraint(SpringLayout.SOUTH, btnSave, -10, SpringLayout.SOUTH, this);
		add(btnSave);
		
		JScrollPane scrollPane = new JScrollPane();
		springLayout.putConstraint(SpringLayout.NORTH, scrollPane, 6, SpringLayout.SOUTH, lblOpenIndents);
		springLayout.putConstraint(SpringLayout.WEST, scrollPane, 10, SpringLayout.WEST, this);
		springLayout.putConstraint(SpringLayout.SOUTH, scrollPane, -10, SpringLayout.NORTH, btnSave);
		springLayout.putConstraint(SpringLayout.EAST, scrollPane, 164, SpringLayout.WEST, this);
		add(scrollPane);
		
		list = new JList();
		scrollPane.setViewportView(list);
		
		scrollPane_1 = new JScrollPane();
		springLayout.putConstraint(SpringLayout.NORTH, scrollPane_1, 6, SpringLayout.SOUTH, lblOpenIndents);
		springLayout.putConstraint(SpringLayout.WEST, scrollPane_1, 10, SpringLayout.EAST, scrollPane);
		springLayout.putConstraint(SpringLayout.SOUTH, scrollPane_1, -10, SpringLayout.NORTH, btnSave);
		springLayout.putConstraint(SpringLayout.EAST, scrollPane_1, -10, SpringLayout.EAST, this);
		add(scrollPane_1);
		
		table = new JTable();
		table.setModel(new DefaultTableModel(
			new Object[][] {
			},
			new String[] {
				"Sr No.", "Item", "Specifications", "Unit", "Quantity", "Project Incharge", "New Quantity", "Comment", "Status"
			}
		) {
			boolean[] columnEditables = new boolean[] {
				false, true, true, true, true, true, true, true, true
			};
			public boolean isCellEditable(int row, int column) {
				return columnEditables[column];
			}
		});
		table.getColumnModel().getColumn(5).setPreferredWidth(131);
		scrollPane_1.setViewportView(table);
	}
	public JLabel getLblOpenIndents() {
		return lblOpenIndents;
	}
	public void setLblOpenIndents(JLabel lblOpenIndents) {
		this.lblOpenIndents = lblOpenIndents;
	}
	public JButton getBtnSave() {
		return btnSave;
	}
	public void setBtnSave(JButton btnSave) {
		this.btnSave = btnSave;
	}
	public JTable getTable() {
		return table;
	}
	public void setTable(JTable table) {
		this.table = table;
	}
	public JList getList() {
		return list;
	}
	public void setList(JList list) {
		this.list = list;
	}
	public JScrollPane getScrollPane_1() {
		return scrollPane_1;
	}
	public void setScrollPane_1(JScrollPane scrollPane_1) {
		this.scrollPane_1 = scrollPane_1;
	}
	
}
